const MINIO_URL = "http://127.0.0.1:9000";
const BUCKET_NAME = "blogsystem-test01";

export function getMinioUrl(path: string): string {
  if (!path || typeof path !== "string") {
    throw new Error("请传入正确的文件路径");
  }
  if (path.startsWith("http")) return path; // 如果已经是完整地址则直接返回
  return `${MINIO_URL}/${BUCKET_NAME}${path}`;
}

export function getMinioUrlList(paths: string[]): string[] {
  if (!paths || !Array.isArray(paths)) {
    throw new Error("请传入正确的文件路径数组");
  }
  console.log("图片转换后的路径：", paths);
  return paths.map((path) => getMinioUrl(path));
}
